package br.com.novagalvao.enums;

import java.lang.reflect.InvocationTargetException;

import org.apache.commons.lang.IncompleteArgumentException;

public enum EnumTipoPao {

	SALGADO(0, "Salgado"),
	
	DOCE(1, "Doce");
	
	private int id;
	private String descricao;
	
	private EnumTipoPao(int id, String descricao){
		this.id = id;
		this.descricao = descricao;
	}
	
	public EnumTipoPao byId(int id){
		
		for(EnumTipoPao e : values()){
			if(id ==  e.id){
				return e;
			}
		}
		
		System.out.println("Error: Enum not found");
		throw new IncompleteArgumentException("Error: Enum not found");
		
	}
	
	public int getId(){
		return this.id;
	}
	
	public String getDescricao(){
		return this.descricao;
	}
	
}
